<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="copyright" content=""/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
	<title>设置-修改资料</title>
	<link href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
	<link href="${pageContext.request.contextPath}/css/system/public.css" />
	<link href="${pageContext.request.contextPath}/css/system/set.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/css/system/alert.css" rel="stylesheet">
	<link href="../favicon.ico" rel="shortcut icon">
	<link href="<%=path%>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
	<link href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
	<link href="<%=path%>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="<%=path%>/hplus/css/animate.min.css" rel="stylesheet">
	<link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/css/system/jquery-ui-themes.css" type="text/css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/css/system/axure_rp_page.css" type="text/css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/css/system/styles.css" type="text/css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/css/system/file/styles.css" type="text/css" rel="stylesheet"/>
<style>
.col-sm-1{
            padding-right: 0;
        }
#u1332_input {
  position:absolute;
  left:244px;
  top:0px;
  width:566px;
  height:92px;
  font-family:'Arial Normal', 'Arial';
  font-weight:400;
  font-style:normal;
  font-size:13px;
  text-decoration:none;
  color:#A1A1A1;
  text-align:left;
}
#u1316 {
    position: absolute;
    left: 25px;
    top: 29px;
    width: 837px;
    height: 427px;
}
#u1341 {
    position: absolute;
    left: 300px;
    top: 400px;
    width: 90px;
    height: 30px;
    background-color: #02c874;
}
#u1343 {
    position: absolute;
    left: 420px;
    top: 400px;
    width: 84px;
    height: 29px;
   background:inherit;
  background-color:rgba(255, 223, 37, 1);
}

#u1331 {
    position: absolute;
    left: 160px;
    top: 0px;
    width: 57px;
    word-wrap: break-word;
}
#u1343_div {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 84px;
    height: 29px;
    background: inherit;
    background-color: rgb(4, 146, 112);
    border: none;
    border-radius: 5px;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

</style>

</head>

<body>
	<div id="base" class="">

      <!-- Unnamed (矩形) -->
      <div id="u1313" class="ax_default box_2" style="height:300px;">
        <!-- Unnamed () -->
        <div id="u1314" class="text" style="display: none; visibility: hidden">
          <p><span></span></p>
        </div>
      </div>

      <!-- 企业信息 (组合) -->
      <div id="u1315" class="ax_default" data-label="企业信息">
		<div style="margin:10px;">
        <!-- Unnamed (矩形) -->
        <div id="u1316" class="ax_default box_1" style="height:300px;">
          <!-- Unnamed () -->
          <div id="u1317" class="text" style="display: none; visibility: hidden">
            <p><span></span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1318" class="ax_default box_1">
          <div id="u1318_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1319" class="text" style="visibility: visible;">
              
            <p>                    
	           <img onchange="Javascript:validate_img(this);" id="micro_pic" src="/images/marketing/img_p.png" width="119" height="119"> 
	          
	            
	          
            </p>
                 
                   
                  
            
          </div>
          
         
        </div>
        
         
                        
                        
                        

        <!-- Unnamed (矩形) -->
        <div id="u1320" class="ax_default">
          <div id="u1320_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1321" class="text" style="visibility: visible;">
            <p>   <span> 
	            
                        <form action="" class="form-inline" id='upload_pic'
											enctype='multipart/form-data'>
                            <input type="file" id="x_inputfile" accept="image/gif,image/jpeg,image/x-png" name="filepath" onchange="uploadPic()" style=" filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.0; position:absolute; z-index:99;">
                        <a href="javascript:;"><font style="margin-left: 15px"  color="#41964e">上传企业logo</font></a>
                   </form></span><br/>
              
                   <span>尺寸:120*120像素</span>
            </p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1322" class="ax_default">
          <div id="u1322_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1323" class="text" style="visibility: visible;">
            <p><span><h4>企业名称</h4></span></p>
          </div>
        </div>
        
        
        
        

        <!-- Unnamed (文本框) -->
        <div id="u1324" class="ax_default text_field" style="width: 500px;">
<!--            <input type="text"  id="c_name"  style="color:gray"/><font style="margin-left: 15px" id="errn" color="red"></font>
 -->         
        <div class="col-sm-9">
       
            <input id="c_name" type="text" name="" style="width: 400px;"class="form-control" placeholder="请输入公司名称"> 
       
        
       
       
        </div><font style="margin-left: 15px" id="errn" color="red"></font>
        
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1325" class="ax_default">
          <div id="u1325_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1326" class="text" style="visibility: visible;">
            <p><span><h4>关键词</h4></span></p>
          </div>
        </div>

        <!-- Unnamed (文本框) -->
        <div id="u1327" class="ax_default text_field" style="width: 500px;">
<!--            <input type="text"  id="c_business"  style="color:gray"/><font style="margin-left: 15px" id="errb" color="red"></font>
 -->
 
           <div class="col-sm-9">
            <input id="c_business" type="text" name="" style="width: 400px;"class="form-control" placeholder="请输入关键词"> 

           </div><font style="margin-left: 15px" id="errb" color="red"></font>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1328" class="ax_default">
          <div id="u1328_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1329" class="text" style="display: none; visibility: hidden">
            <p><span></span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1330" class="ax_default">
          <div id="u1330_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1331" class="text" style="visibility: visible;">
            <p><span><h4>企业介绍</h4></span></p>
          </div>
        </div>

        <!-- Unnamed (文本框) -->
        <div id="u1332" class="ax_default text_field" >
<!--           <input id="u1332_input" type="text" value=""/>
 -->       
            <div class="col-sm-9">
            <textarea id="u1332_input"  style="width: 400px;" name="" class="form-control" placeholder="请输入企业简介"></textarea>

           </div><font style="margin-left: 15px" id="erri" color="red"></font>
        </div>

        <!-- Unnamed (文本段落) -->
        <div id="u1333" class="ax_default _文本段落">
          <img id="u1333_img" class="img " src="${pageContext.request.contextPath}/images/system/u1044.png"/>
          <!-- Unnamed () -->
          <div id="u1334" class="text" style="visibility: visible;">
            <p><span><font style="margin-left: 15px"  color="red"></font>&nbsp; </span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1335" class="ax_default">
          <div id="u1335_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1336" class="text" style="visibility: visible;">
            <p><span><h4>企业电话</h4></span></p>
          </div>
        </div>

        <!-- Unnamed (文本框) -->
        <div id="u1337" class="ax_default text_field" style="width: 500px;">
<!--             <input type="text"  id="c_phone" placeholder="请输入企业电话" maxlength="20" onkeyup="this.value=this.value.replace(/[^0-9|^-]/g,'')"  onafterpaste="this.value=this.value.replace(/[^0-9|^-]/g,'')"/><font style="margin-left: 15px" id="err" color="red"></font>
 -->      <div class="col-sm-9">
           
            <input type="text"  class="form-control" style="width: 400px;" id="c_phone" placeholder="请输入企业电话" maxlength="20" onkeyup="this.value=this.value.replace(/[^0-9|^-]/g,'')"  onafterpaste="this.value=this.value.replace(/[^0-9|^-]/g,'')"/>
           </div><span><font style="margin-left: 15px" id="err" color="red"></font></span>
           
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u1338" class="ax_default">
          <div id="u1338_div" class=""></div>
          <!-- Unnamed () -->
          <div id="u1339" class="text" style="visibility: visible;">
            <p><span><h4>企业地址<h4></span></p>
          </div>
        </div>

        <!-- Unnamed (文本框) -->
        <div id="u1340" class="ax_default text_field" style="width: 500px;">
<!--          <input type="text"  id="c_address"  style="color:gray" /><font style="margin-left: 15px" id="erra" color="red"></font>
 -->
 
           <div class="col-sm-9">
            <input id="c_address" type="text" name="" style="width: 400px;"class="form-control" placeholder="请输入企业地址">
             
           </div>
           <div class="col-sm-9">
           <font style="margin-left: 15px" id="erra" color="red"></font>
           </div>
        </div>
        	<div class="row" style="margin-top:50px;">
           <button type="button" class=" btn btn-outline btn-primary col-sm-4" id="close" style="margin-right:20px;width:100px;margin-left: 850px;" onclick="window.location.href='${pageContext.request.contextPath}/ui/mainView?menuId=150&amp;menuName=设置'">返回</button>   
			<button type="button" class=" btn btn-primary k_verify col-sm-4" style="width:100px;margin-left: 1000px; margin-top:-35px;"id="endEdit">修改</button>
			</div>
      </div>
</div>
      <!-- Unnamed (矩形) -->
    
	

 	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/system/upload.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/system/exit.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/system/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/system/jquery.iframe-transport.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/system/jquery.fileupload.js"></script>	
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js"></script>
    
    <script>

        $('.s_keyword input').on('keydown',function(e){
            $(this).parents('.s_keyword').find('span').show();
            if(e.keyCode==13){
                var keyword = $.trim($('.s_keyword input').val());
                var html = "";
                var len = $('.key>div').length;

                var newLen = $('.key>div').length;
                if(len>4){
                    $('.s_keyword input').hide();
                    $('.s_keyword em').show();
                }
                if(!keyword==""){
                    if(len>=5){
                        return false;
                    }
                    if(keyword.indexOf(',') != -1 || keyword.indexOf('，') != -1 || keyword.indexOf('、') != -1){
						showDialog("不能添加逗号、顿号");
						$('.s_keyword input').val('');
						return false;
                    }
                    html = "<div><div>"+keyword+"<img class='del' src='${pageContext.request.contextPath}/images/system/del-1.png'/></div></div>"
                }
                /*判断关键字不能相同   start*/
                var kfs = $('#kf').children(); 
                var fflag = true;
                kfs.each(function(){
					var cf = $(this).text();
						if(cf == keyword){
							fflag = false;
							return ;
						}
				}); 
                 if(fflag){
                	 	$('.key').append(html);
						$('.s_keyword input').val('');
		                $(this).parents('.s_keyword').find('span').hide()
                 }else{
                	 	showDialog("不能重复添加相同的关键字");
						$('.s_keyword input').val('');
                 }
                 len = $('.key>div').length;
                 if(len>4){
                     $('.s_keyword input').hide();
                     $('.s_keyword em').show();
                 }
            }
        });
        
        
        
        /* 判断图片像素大小 */
        function validate_img(a){
		 var file = a.value;
		 if(!/.(gif|jpg|jpeg|png|GIF|JPG|png)$/.test(file)){
		  alert("图片类型必须是.gif,jpeg,jpg,png中的一种");
		  return false;
		}else{
		     var image = new Image();
		     image.src = file;
		     var height = image.height;
		     var width = image.width;
		     var filesize = image.filesize;
		      alert(height+"x.."+filesize);
		     if(width>120 && height>120 && filesize>102400){
		      alert('请上传80*80像素 或者大小小于100k的图片');
		      return false;
		     }
		 }
            alert("图片通过");
        }

        $('body').on('click','.del',function(){
            $('.form input').show();
            $('.s_keyword em').hide();
            $(this).parent().parent().remove();
        });

        /* $('#scxs').click(function(){
            $('.k_popup').show();
            $('.k_issues').show();
        }); */
        $(document).on('click','.xian',function(){
        	$('.k_popup').show();
            $('.k_issues').show();
        });
        $('.k_issues span').click(function(){
            $('.k_popup').hide();
            $('.k_issues').hide();
        });
        $(function(){
            $('.k_issues span').on('click',function(){
                $('.k_popup').hide();
            })
            $('.s_delect_btn').on('click',function(){
                $('#preview').html('');
                $('#s_charter').text("");
                $("#s_delect_btn").hide();
            })
        });
                $(function(){
            var cityJSON = null;
            var cityText = "";
            var industryJson = null;
            var optionText = "";
            var itemNum = 0;
            $.getJSON("${pageContext.request.contextPath}/js/system/industry.js",function(result){
                industryJson = result["industry"];
                var industry = "";
                $.each(industryJson,function(i,item){
                    industry+="<li><a href='javascript:void(0);'>"+item['p']+"<input class='industryIndex' type='hidden' value='"+i+"'/></a></li>";
                    console.log(industry);
                    $('.parentOption').html(industry)
                });
                $.getJSON("${pageContext.request.contextPath}/js/system/city.js",function(result){
                    cityJSON = result["citylist"];
                    var pro = "";
                    $.each(cityJSON,function(i,item){
                        pro+="<li><a href='javascript:void(0);'>"+item['p']+"<input class='proIndex' type='hidden' value='"+i+"'/></a></li>";
                    })
                    $('.pro').html(pro)
                });
                var proIndex = null;
                $('.pro').on('mouseenter','li',function(e){
                    e.stopPropagation();
                    proIndex = $(this).find('.proIndex').val();

                    console.log(proIndex)
                    if(Number(proIndex)!=0 && Number(proIndex)!=1 && Number(proIndex)!=8 && Number(proIndex)!=21){
                        cityText = $(this).find('a').text()+"省";
                    }else{
                        cityText = $(this).find('a').text()+"市";
                    }
                    $(this).find('a').addClass('on').parent().siblings().find('a').removeClass('on');
                    var city = cityJSON[proIndex]["c"];
                    var cityHTML = "";
                    $.each(city,function(i,item){
                        cityHTML+="<li><a href='javascript:void(0);'>"+item['n']+"<input class='cityIndex' type='hidden' value='"+i+"'/></a></li>";
                    })
                    $('.city').html(cityHTML);
                    $(this).parents('.s_dropdown').find('.dropdownRight').show();
                });


                var industryIndex = null;
                $('.parentOption').on('click','li',function(e){
                    var industryText = "";
                    optionText="";
                    e.stopPropagation();
                    optionText+=$(this).find('a').text()+"-";
                    industryIndex = $(this).find('.industryIndex').val();
                    $(this).find('a').addClass('on').parent().siblings().find('a').removeClass('on');
                    var industrys = industryJson[industryIndex]["c"];
                    var industryHTML = "";
                    $.each(industrys,function(i,item){
                        industryHTML+="<li><a href='javascript:void(0);'>"+item['n']+"<input class='cityIndex' type='hidden' value='"+i+"'/></a></li>";
                    })
                    $('.childOption').html(industryHTML);
                    $(this).parents('.s_dropdown').find('.dropdownRight').show();
                });

                $('.childOption').on('click','li',function(e){
                    e.stopPropagation();
                    industryText=$(this).find('a').text();
                    optionText+=$(this).find('a').text();

                    $(this).parents('.s_dropdown').find('.dropdown-menu').hide();

                    $('.industryTextBtn').text(industryText);
                    $('.industryTextVal').val(optionText);
                    cityText = "";
                    $('.dropdown-toggle').removeClass('btnOn');
                });

                $('.city').on('click','li',function(e){
                    e.stopPropagation();
                    console.log(proIndex)
                    if(Number(proIndex)!=0 && Number(proIndex)!=1 && Number(proIndex)!=8 && Number(proIndex)!=21 && Number(proIndex)!=33){
                        cityText+=$(this).find('a').text()+"市";
                    }else{
                        cityText += $(this).find('a').text();
                    }

                    $(this).parents('.s_dropdown').find('.dropdown-menu').hide();
                    $('.cityTextBtn').text(cityText);
                    $('.cityTextVal').val(cityText);
                    $('.cityText').show();
                    cityText = "";
                    $('.dropdown-toggle').removeClass('btnOn');
                });
                $('.dropdown-toggle').on('click',function(e){
                    e.stopPropagation();
                    $('.dropdown-menu').hide();
                    $(this).toggleClass('btnOn');
                    if($(this).hasClass('btnOn')){
                        $(this).next().show();
                    }else{
                        $(this).parent().find('.dropdown-menu').hide();
                    }
                });

                $('body').on('click',function(){
                    $('.dropdown-menu').hide();
                    $('.dropdown-toggle').removeClass('btnOn');
                });

                $('.s_fx_li1').click(function(){
                  var id = $(this).find('img').attr('_id');
                    if(id == 1){
                      $('.s_fk_pic1').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
                      $(this).find('img').attr('_id' , '2');
                    }else{
                      $('.s_fk_pic1').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
                      $(this).find('img').attr('_id' , '1');
                    }
                });
                $('.s_fx_li2').click(function(){
                  var id = $(this).find('img').attr('_id');
                    if(id == 3){
                      $('.s_fk_pic2').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
                      $(this).find('img').attr('_id' , '4');
                    }else{
                      $('.s_fk_pic2').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
                      $(this).find('img').attr('_id' , '3');
                    }
                });
                $('.s_fx_li3').click(function(){
                  var id = $(this).find('img').attr('_id');
                    if(id == 5){
                      $('.s_fk_pic3').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
                      $(this).find('img').attr('_id' , '6');
                    }else{
                      $('.s_fk_pic3').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
                      $(this).find('img').attr('_id' , '5');
                    }
                });
                $('.s_fx_li4').click(function(){
                  var id = $(this).find('img').attr('_id');
                    if(id == 7){
                      $('.s_fk_pic4').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
                      $(this).find('img').attr('_id' , '8');
                    }else{
                      $('.s_fk_pic4').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
                      $(this).find('img').attr('_id' , '7');
                    }
                });
                $('.s_fx_li5').click(function(){
                  var id = $(this).find('img').attr('_id');
                    if(id == 9){
                      $('.s_fk_pic5').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
                      $(this).find('img').attr('_id' , '10');
                    }else{
                      $('.s_fk_pic5').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
                      $(this).find('img').attr('_id' , '9');
                    }
                });
            })
            $('.addEle').on('keydown',function(e){
                var ele = "";
                if(e.keyCode==13){
                    var con = $.trim($(this).val());
                    if(con==""){
                        $(this).val('');
                        return false;
                    }
                    if(itemNum>=3){
                        return false;
                    }
                    itemNum++;
                    if(itemNum==3){
                        $('.addEle').css('visibility','hidden');
                        $('.showDialogWord').css('visibility','hidden');
                    }
                    ele = '<li class="s_fx_li1 c_li"><img src="${pageContext.request.contextPath}/images/system/s_check.png" class="c_'+itemNum+'" _id="c_'+itemNum+'" />'+con+' <img class="k_del" src="images/k_close.png" /></li>';
                    $('.s_login_box ol').append(ele);
                    $(this).val('');
                }
            })
            $('body').on('click','.k_del',function(){
                $(this).parent().remove();
                $('.addEle').css('visibility','visible');
                $('.showDialogWord').css('visibility','visible');
                itemNum--;
            })
        })
       
    </script>
        <!-- LeeX -->
    <script type="text/javascript">
    $(function(){
		$.post("<%=path%>/api/company/show",function(data){
			if(data.error_code == "20028"){
				showDialog(" 账户已被登陆，请重新登陆。");
				setTimeout('window.location.href="http://scrm.cecook.cn/"',2000);
			
			}
			
		    console.log(data);
			/*企业信息*/
			
			var name =data.name;
			var city=data.city;
			var intro=data.intro;
			var business=data.business;
			var phone =data.phone;
			logo = data.logo;
			
			$('#c_phone').val(phone);
				
			$('#c_name').val(name);
				
				
			$('#c_business').val(business);
			$('#c_address').val(city);
			$('#u1332_input').text(intro);
			
		/* 	if(""==logo){
		     	$("#logo").text("上传企业LOGO");
		     	
		    }else{
		    	$("#micro_pic").attr("src",logo);
		    } */
			
			
			if(typeof(logo)=="undifined"){
				alert();
				$('#logo').text("上传企业LOGO");
				
				
			}else{
				console.log("logo---->"+logo);
				$("#logo").text("修改logo");
				
				$("#micro_pic").attr("src",logo);
				//$('#scxs').html('<img src="'+logo+'" class="xian" width="192px" height="119px">');
				//$('#datu').attr("src",logo);
				/* var strs = b_license.split("/");
				 for(var i = 0 ; i < strs.length ;i++){
					if(i == strs.length - 1){
	    				$('.s_charter').text(strs[i]);
					}
				}  */
			}
			/* 关键字 */
			/* var kw = data.keyword;
			var arr = kw.split(",");
			if(arr[0] != ""){
				for(var i = 0 ; i < arr.length;i++){
					$('#kf').append('<div><div>'+arr[i]+'<img class="del" src="${pageContext.request.contextPath}/images/system/del-1.png"/></div></div>');
				}
			} */
			
			kfl = "y";
			doch();
		});
	
		$('#return').click(function(){
			  window.location.href = "<%=path%>/ui/mainView";
			  
			});
		$('#endEdit').click(function(){
		
			/* 公司名称 */
			 var e_name = $('#c_name').val();
			/* 地区 */
			var e_city = $('#c_address').val();
			/* 行业 */
			/* var e_industry = $('#industryTextBtn').val(); */
			if(!checkInfo()){
				return;
			}
			/* 电话 */
			var e_phone = $('#c_phone').val();
			/* 介绍 */
			var e_intro = $('#u1332_input').val();
			console.log(e_intro);
			/* 关键词 */
			var e_business = $('#c_business').val();
			
			var url = "<%=path%>/api/company/update";
			
			if(typeof(pic) == "undefined"){
			   
			}else{
				img=pic;
			}
			var params = {
					"company":e_name,
					"phone":e_phone,
					"city":e_city,
					"intro":e_intro,
					"business":e_business,
					"logo":img
				};
			/* 发送请求 */
			var flag=false;
			$.post(url,params,function(data){
				if(data.error_code == "20028"){
					showDialog(" 账户已被登陆，请重新登陆。");
					setTimeout('window.location.href="http://scrm.cecook.cn/"',2000);
				}else if("修改企业信息失败"==data.message){
					
					alert("修改失败,请重新修改!");
					return;
				}else{
					alert("修改成功!");
				}
				
					
	        	if(flag){
	        		return ;
	        	
	        	
					
					
					
					window.location.href = "<%=path%>/ui/companyInfoShow";
				}else{
					showDialog(data.message);
					window.location.href = "<%=path%>/ui/companyInfoShow";
				}
			});
		});
    });
	
		//上传图片
		var flag=false;
		var pic;
		var img;
		var logo;
		function uploadPic() {
	        $("#upload_pic").submit(function () {  
	        	if(flag){
	        		return ;
	        	}
	        	flag=true;
	            $("#upload_pic").ajaxSubmit({
	                type: "post",
	                url: "${pageContext.request.contextPath}/api/uploadfile/file",
	                data:{"typename":"filepath"},
	                success: function (data1) {
	                	
	                	pic=data1.realSavePath;
	                	 if(pic!=""){
	                        	$("#logo").text("修改logo");
	                        	$("#micro_pic").attr("src",pic);
		                	}
	                	
	                },
	                error: function (msg) {
	                     
	                }
	            });
	            return false;
	        });
	        flag=false;
	        $("#upload_pic").submit();
		}	
		
		
    </script>
<script type="text/javascript">
 $(function(){
	 /*$(":file").click(function(){
		$('.uploadFile').fileupload({
			url : "${pageContext.request.contextPath}/api/company/uploadLogo",
			iframe: true,
			dataType:"json",
			done : function(e,data) {
				if("10010"==data.result.error_code){
					showDialog(data.result.error_msg);	
				}else{
					$('#scxs').html('<img src="'+data.result.b_license+'" class="xian" width="192px" height="119px">');
					$('#datu').attr('src',data.result.b_license);
					showDialog("上传成功");
				}
			},

		});
	}); */
	
	
	
	
	$('.s_delect_btn').click(function(){
		$.post(
				"${pageContext.request.contextPath}/api/company/delBLicense",
				{},
				function(data){
					if(data.error_code == "20028"){
						showDialog(" 账户已被登陆，请重新登陆。");
						setTimeout('window.location.href="http://scrm.cecook.cn/"',2000);
					}
					if(data.error_code == "10010"){
						showDialog(data.message);
					}
		},'json');
	});
});
</script>
<script type="text/javascript">
	var kfl ;
	function doch(){
		if(kfl == "y"){
			var kfss = $('#kf').children();
			if(kfss.length == 5){
				$('#i,#s').hide();
				$('#e').show();
			}
		}
	}
	var reg = /^((0|[2-9])[0-9]{2,3})?(\-)?([2-9][0-9]{3,7})+(\-)?([0-9]{0,8})?$/;
	function checkInfo(){
		
		var c_phone = $('#c_phone').val();
		var c_name = $('#c_name').val();
		var c_business= $('#c_business').val();
		var c_address = $('#c_address').val();
		var c_intro = $('#u1332_input').val();
		
		
		if(c_phone == null || c_phone =="" || c_name==null || c_name =="" || c_business==null ||
		   c_business =="" || c_address==null || c_address=="" || c_intro==null || c_intro==""){
			return false;
		}
		
		if(!reg.test(c_phone)){
			$('#err').text("固定电话格式不正确，例：010-22345678 或 01022345678");
			return false;
		}else{
			return true;
		}
		if(15>=c_name.length){
		
			return true;
		}else{
			
			return false;
		}
		if(15>=c_business.length){
			
			return true;
		}else{
			
			return false;
		}
        if(30>=c_address.length){
			
			return true;
		}else{
			
			return false;
		}
       if(50>=c_intro.length){
			
			return true;
		}else{
			
			return false;
		}
		
		
	}
	
	$('#c_phone').blur(function(){
		var c_phone = $('#c_phone').val();
		if(c_phone==null||c_phone==""){
			$('#err').text(" 电话不能为空");
		}else if(!reg.test(c_phone)){
			$('#err').text("固定电话格式不正确，例：010-22345678 或 01022345678");
		}else{$('#err').text("");}
		
	});
	$('#c_name').blur(function(){
	
		var c_name = $('#c_name').val();
		
		if(c_name==null||c_name==""){
			$('#errn').text(" 企业名称不能为空");
		}else if(!16>c_name.length){
			$('#errn').text(" 企业名称不超过15个字符");
		}else{$('#errn').text("");}
	});
	$('#c_business').blur(function(){
		
		var c_business= $('#c_business').val();
	
		if(c_business==null||c_business==""){
			$('#errb').text(" 关键字不能为空");
		}else if(!16>c_business.length){
			$('#errb').text(" 关键字不超过15个字符");
		}else{$('#errb').text("");}
	});
	$('#c_address').blur(function(){

		var c_address = $('#c_address').val();
	
		if(c_address==null||c_address==""){
			$('#erra').text(" 地址不能为空");
		}else if(!31>c_address.length){
			$('#erra').text(" 地址不超过30个字符");
		}else{$('#erra').text("");}
	});
	$('#u1332_input').blur(function(){
		
		var c_intro = $('#u1332_input').val();
		if(c_intro==null||c_intro==""){
			$('#erri').text(" 企业简介不能为空");
		}else if(!51>c_intro.length){
			$('#erri').text(" 地址不超过50个字符");
		}else{$('#erri').text("");}
	});
	
	
	
	
	
</script>
<script type="text/javascript">
var auths = "<%=session.getAttribute("authoritys")%>";
</script>
</body>
</html>